<?php
namespace Plugin\Gq\VideoMonitoring\Schema;

use Plugin\Gq\VideoMonitoring\Model\GqVideoCamera;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 摄像头管理
 */
#[Schema(title: 'GqVideoCameraSchema')]
class GqVideoCameraSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'type', title: '摄像头分类ID', type: 'integer')]
    public string $type;

    #[Property(property: 'name', title: '摄像头名称', type: 'varchar')]
    public string $name;

    #[Property(property: 'short_name', title: '摄像头简称', type: 'varchar')]
    public string $short_name;

    #[Property(property: 'device_code', title: '设备编号', type: 'varchar')]
    public string $device_code;

    #[Property(property: 'device_serial', title: '设备序列号', type: 'varchar')]
    public string $device_serial;

    #[Property(property: 'manufacturer', title: '厂家', type: 'varchar')]
    public string $manufacturer;

    #[Property(property: 'ip_address', title: 'IP地址', type: 'varchar')]
    public string $ip_address;

    #[Property(property: 'port', title: '端口号', type: 'int')]
    public string $port;

    #[Property(property: 'username', title: '账户', type: 'varchar')]
    public string $username;

    #[Property(property: 'password', title: '密码', type: 'varchar')]
    public string $password;

    #[Property(property: 'play_url', title: '播放地址(RTSP/FLV)', type: 'text')]
    public string $play_url;

    #[Property(property: 'location', title: '位置', type: 'varchar')]
    public string $location;

    #[Property(property: 'longitude', title: '经度坐标', type: 'decimal')]
    public string $longitude;

    #[Property(property: 'latitude', title: '纬度坐标', type: 'decimal')]
    public string $latitude;

    #[Property(property: 'status', title: '状态: 1=在线, 0=离线', type: 'tinyint')]
    public string $status;

    #[Property(property: 'created_at', title: '创建时间', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: '更新时间', type: 'timestamp')]
    public string $updated_at;




    public function __construct(GqVideoCamera $model)
    {
       $this->id = $model->id;
       $this->name = $model->name;
       $this->short_name = $model->short_name;
       $this->device_code = $model->device_code;
       $this->device_serial = $model->device_serial;
       $this->manufacturer = $model->manufacturer;
       $this->ip_address = $model->ip_address;
       $this->port = $model->port;
       $this->username = $model->username;
       $this->password = $model->password;
       $this->play_url = $model->play_url;
       $this->location = $model->location;
       $this->longitude = $model->longitude;
       $this->latitude = $model->latitude;
       $this->status = $model->status;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'name' => $this->name ,'short_name' => $this->short_name ,'device_code' => $this->device_code ,'device_serial' => $this->device_serial ,'manufacturer' => $this->manufacturer ,'ip_address' => $this->ip_address ,'port' => $this->port ,'username' => $this->username ,'password' => $this->password ,'play_url' => $this->play_url ,'location' => $this->location ,'longitude' => $this->longitude ,'latitude' => $this->latitude ,'status' => $this->status ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}